﻿using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using CMS.Web.Controllers;
using CMS.Web.Data;

namespace CMS.Web.Engine
{
    public class ControllerFactory : DefaultControllerFactory
    {
        protected override IController GetControllerInstance(RequestContext context, Type controllerType)
        {                
            if (controllerType.IsNull())
                throw new ArgumentException("Не передан тип контроллера.", "controllerType");            

            return IoCContainer.Current.Resolve(controllerType) as IController;
        }
    }
}